<template>
 <section class="navtab-box">
    <ul class="nav-tab">
              <li
                :class="{'navActive':navIndex==index}"
                v-for="(nav,index) in headData"
                :key="index" 
                @click="navClick(index)"
              >{{nav.name}}</li>
            </ul>
 </section>
</template>
<script>
export default {
    props:{
        headData:Array,
        navIndex:Number
    },
    methods:{
        navClick(index){
            this.$emit('navClick',index)
        }
    }
    
}
</script>
<style scoped>
.navtab-box {
  width: 100%;
  display: flex;
  justify-content: center;
}
.nav-tab {
  width: 80%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 2rem;
}
.nav-tab > li {
  text-align: center;
  margin-right: 0.5rem;
  color: #fff;
  flex: 1;
  height: 3rem;
  line-height: 3rem;
  font-size: 0.8rem;
}
.nav-tab > li:before{
  width: 40px;
  content: '';
  display: block;
  background: url(../assets/分割线.png) no-repeat center;
}
.nav-tab > li:last-child {
  margin-right: 0;
}
.navActive {
  background: linear-gradient(
    90deg,
    rgba(5, 15, 76, 1) 0%,
    rgba(9, 43, 156, 1) 100%
  );
  border-radius: 10px;
}

</style>